home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Datafile PD-CD 1 Issue 2
/
PDCD-1 - Issue 02.iso
/
_utilities
/
utilities
/
003
/
_mask
/
!Mask
/
!Help
< prev
next >
Wrap
Text File
|
1993-09-17
|
19KB
|
418 lines
Version=1.11 You may copy this program for non-commercial reasons only.
summary:
!Mask is an application which allows you select certain items of a picture.
For example you can isolate yellow text from a blue-ish picture. The program
also offers some image processing possibilities like photomorphing.
Input files are always clear or sprite files, output files are always clear
files. In the clear format you have a 24 bit palette or full 24 bit color.
You can translate clears<>sprites using !Translator, see below.
Main features:
1)Selecting & isolating objects in an image, based on its color, hue, etc.
2)Erasing objects in an image
3)Changing the color of objects in an image
4)Morphing one picture gradually into another
*********************************GETTING STARTED***************************
Give the program as much memory as possible, but leave enough screenmemory.
Press the select button over an object in the top-left window. For example
the M of 'megadeth'. Than press menu in the top-left window or press it
above the vertical bar. A mask will be made in about 0.6 (arm2) or
0.15 (arm3) seconds.
*********************************MASKING***********************************
Making masks from r,b,g values in the original image:
grey:
Compares grey values of pixels and target pixel.
rule: (r+g+b)-(Tr+Tg+Tb)<d
rgb:
Compares distance of the rgb vector of a pixel and target pixel.
rule: (r-Tr)▓+(g-Tg)▓+(b-Tb)▓<d▓
color:
Compares 'color' of pixels. This is the best choice in most cases.
Note that masking this way will also select black (rgb=0,0,0) and
possibly other dark colors. This option is of no use to monochrome
images.
rule: v=r+g+b:t=Tr+Tg+Tb:(r*t-Tr*v)▓+(g*t-Tg*v)▓+(b*t-Tb*v)▓<d▓*v▓*t▓
edge:
Tries to find edges in the picture. Rather slow.
rule: Er▓+Eg▓+Eb▓>d▓ ,with Er,Eg,Eb the edginess of a point, defined
by sobelX▓+sobelY▓.
hue:
Compares color of pixels, but in another way than 'color'.
The hue of a pixel is not depending on its brightness, nor its
'whiteness'. So it may do well in overexposed images.
rule:(h(target)-h(pixel))mod (2*PI)<d , with h(r,g,b)=
arctan2(r-2/3*sqr(3)*(g+b) , 1/2*g-1/2*b). This is not (and probably
will never be) implemented for full 24 bit files.
(Tr,Tg,Tb) is the color of the target (selected) pixel.
You can activate the mask routines by pressing menu in the top-left window,
or elsewere, or by selecting a new mask-button.
You can change the value of 'd' by dragging the bar in the middle of the
screen. Dragging with the menu-button will start calculation immediately.
To set the target pixel, use the select-button in the top-left window.
You can make a rectangular mask by setting a rectangle with the adjust-
button in the top-left window.
You can edit pixels by using menu (setting) and adjust (removing) in the
down-left window.
Selecting groups:
By clicking select on a 4-connected group in the down-left window will
select this group as the current mask.
Shift-clicking select on a group that is not masked out, will remove
that group from the current mask.
Shift-clicking select on a masked out group, will add that group to the
current mask.
N.b. both groups that are in and out the mask are considered to be
groups.
*********************************MASK PROCESSING***************************
binary operations:
not :z=not x
and :z=x and y
eor :z=x eor y
or :z=x or y
andnot:z=x and not y
= :z=x
0 :z=0
1 :z=1
where z is the current mask, (yellow frame) and x and y have to be
selected, and may be equal to z.
seed x:
selects all 4-connected objects in the current mask, that are pointed
at by the pixels in mask x. There is a maximum of pixels that will be
used as seed. This operation may fail if there is not enough memory.
large x:
select all 4-connected objects in the current mask, that are thicker
(in both directions) than x.
noise x:
removes noise (pixels with less than x 8-connected neighbours)
if x=8 then this is equivalent to erodating the image.
Setting x to 3 removes all thin lines in the image.
dilation x:
adds pixel if it has at least x 8-connected neighbours.
nb. dilation(image,x)=not(noise(not image,9-x))
*********************************INPUT/OUTPUT******************************
loading:
Enter a filename or enter return to abort loading.
load options:
pic load a clear or sprite file as the main picture. All 2, 4, 16
and 256 color sprites are supported, including 256 grey-level
sprites. If no palette is given, the desktop colors are used
instead. If a sprite has a mask, this will be loaded and used
as the currently selected mask. If there is not enough memory
for the image, it can happen that the program has to quit.
Loading 2,4 and 16 color sprites may be slow.
mask load a binary clear file as the current mask. The file has to
have the same size as the main picture.
back replaces the masked out part of the main picture by the file
loaded. The loaded file must have the same size (x & y) as
the current picture. Currently this option works only if both
the current and loaded picture are full 24 bit images.
saving:
Enter a filename or enter return to abort saving.
save options:
pic save whole picture (masked). Masked out parts of the picture
are replaced by the nearest color in the images palette.
smpic make the picture as small as possible and than save it.
mask save the current mask as a binary clear file.
*********************************IMAGE PROCESSING**************************
Image processing options:
Map:
Loads a color transformation file, and than transforms the colors,
according to this file. You can make the file yourself, by editing
!Mask.GenMap
options: entering return will give you the default file:<Mask$Dir>.Maps.
Mymap
entering 'last' will give you the last used map
or enter the name of the file.
InvM:
Inverts the color of the part of the image that is in the mask.
êë:
Flips image in y-axes.
èï:
Flips image in x-axes.
24b:
Converts paletted images to full 24 bit images. This can be useful as
some options in this program only work with 24 bit images. This operation
may destroy some masks, without warning. The masks will be compressed and
stored in the scrap-directory.
Erase:
Removes the selected part from the image. The removed part of the
image is filled up with colors, totally depending on the edge of the
mask. In some cases it is possible to remove something out of the
image without leaving visible traces. The method used for filling
up the image is Gauss-Seidel iteration. Currently a slow implementation
is used for which execution time is about equal to c*P▓ , with c
some constant depending on your machine and the shape of the mask and
P is the number of pixels involved. The calculations take place in the
smallest rectangle, surrounding the mask. If you get the message:'doing
800 iterations', the calculation will take about 3 minutes on an arm3.
So make the mask as small as possible! This works only for 24 bit
images.
Col:
Changes the color of the pixels in the mask. The resulting image will
be monochrome. Options:
C :the new color will be the some as that of the currently selected
pixel
N :enter values for red, green and blue. The values must a positive
number (like 0.71 or 4000)
A :Abort operation
Grey:
Changes the grey-value of the pixels in the mask by a specified factor.
Gamma:
Performs gamma-correction on the pixels in the mask. Gamma < 1 makes
the picture darker, gamma >1 makes it lighter. Darker parts are affected
more than light parts. Rule: dest=source^(1/gamma). It can also be
used on overexposed images: First invert the image, then use 'gamma',
and invert again.
Filt:
Multiply each color-component of the pixels in the mask by the given
value. In many cases this should be preferred above the 'Col' operation.
Contrast:
Increases the contrast of the pixels in the mask, compared to the
pixels surrounding the mask. It should be used to make faint, isolated
objects in the picture better visible.
Sharp:
Makes the picture sharper. Strength should be between 0 (no effect) and
1 (strong effect), but may vary from -4 to +4. Making JPEGed pictures
sharper can give strange effects, caused by blocking. The operation
only applies on the pixels in the mask, which are not on the edge of the
picture. Don't use this on dithered pictures. Sharp -0.25 makes the
picture smooth.
Undo:
Undoes the last change made to the main picture. Note that the undo-
option must be on to have something to undo.
Morph:
Does a photomorphing on one or two images. If on two images, these
images will be mixed. If you do your best, you can get animations like
those in Micheal Jacksons video clip 'black or white'. Mixing can
be done only on two 24 bit images, of the same size. Pure morphing
however can be done on paletted images too.
type 1: normal photomorphing on one picture:
The current picture can be either a paletted or 24 bit image.
1. First you are asked to give the filename of a secondary (clear)
picture. The only thing you can do with this picture, in type 1
morphing is view it. Just enter return if you don't want it.
The second image must have the same size (x & y) as the first and
may not have more bits per pixel.
2. If the first picture was 24 bit, and you have loaded a second
picture, you are asked if you want to interpolate, if yes, you
will be doing a type 2 morphing.
3. After that the number of steps are asked, so you can gradually
morph the picture. (and make an animation of it!)
4. If you take more than one step, there is an option to save the
generated pictures. The pictures will be saved in a directory and
be numbered 000, 001, 002, etc.
5. You are asked to load a point file. This is a file, describing
the transformation. Use this only if you have a point file for
this particular picture.
6. You are now ready to set the transformation. Press select somewhere
in the picture, (keep holding it), move the mouse and let go. The
point you just pointed at, will be moved along the line. You can use
adjust to move points around.
7. Press menu. Wait. Ready.
(It is easier as it seems:just press return twice)
type 2: photomorphing, mixing and movie-making of two pictures:
This will gradually morph and mix two different images into eachother.
Both pictures must be 24 bit images and must have the same x & y size.
1. First you are asked to give the filename of a secondary (clear)
picture.
2. You are asked if you want to interpolate, if no, you will be doing
a type 2 morphing, so the 'Y'.
3. The number of steps is asked. If you want to make a movie, take
at least 8 steps. Note you can have 73 steps at most, because only
77 files may be in one directory.
4. The filename is asked. A directory with this name will be created,
containing:<dir>.sec. <dir>.mix. <dir>.spr. and <dir>.Points
5. You are asked to load a point file. This is a file, describing
the transformation. Use this only if you have a point file for
this particular picture.
6. You are now ready to set the transformation. Press select somewhere
in the picture, (keep holding it), move the mouse and let go. The
point you just pointed at, will be moved along the line. If you
want a nice morphing, make that items in the first picture cor-
respond with the same item in the second: e.g. connect eyes, top
of the nose, middle of the mouth, ears, etc, etc. You can use adjust
to move points around.
7. Press menu. Wait. Ready. Note that morphing may use a huge amount
(temporary) on your hard-disc: 3*steps*size of picture and a
'disc full' error is fatal.
Making movies:
When type 1 morphing, you will find your pictures in the named
directory, named 000, 001, etc., one which is a link. When type 2
morphing you will find your pictures in <dir>.mix., named 000, 001,
etc., two of which are links. Use !Translator to convert these
pictures to sprites. Save the sprites in <dir>.spr. Use
!MaskUtils.!Rename to rename the internal sprite names. Place all
the sprites in one spritefile, using paint and save. You now have
an animation file, which can be used by !MaskUtils.!Animator. Very
nice results can be made if you do your best!
bwrgbpcygRB:
Set the color for a masked-out part. When saving, this color will be
approximated by the best fitting color in the palette.
Shift-select in the top-left window will draw a line. The color of this
line is changed gradually from point a to point b. You should only
use this option, if you can see separate pixels. The option can be
very useful when erasing things. Currently this works only for 24 bit
images.
*********************************DISPLAY & OPTIONS*************************
zoom: zoom to the currently selected point
unzoom: zoom out
mask Zoom into the selected mask
X Show full image
arrows Move through picture
DMA Turns dma off in large calculations. Applies for: morph, edge,
ChngCol,Erase,Contrast. You can set it on startup changing the
!Mask.!Defaults file.
FD Fast display. This turns dithering off. You can set it on startup
by changing the !Mask.!Defaults file.
PAL Toggle between the two selectable palettes.One is the default
palette, the other is:BGGRRRBG. This gives a somewhat better
picture in most cases. You can select it on startup by changing
the !Mask.!Defaults file.
UNDO toggle undo on/off. When on, before the main image is changed, it
is saved as <Wimp$ScrapDir>.MaskBackup The image is not saved
after inverting. The default undo-setting is set in the
!Mask.!Defaults file.
*********************************HIDDEN OPTIONS****************************
You are not supposed to use these options:
ñ Do a speed test for displaying (it will mess up your screen)
T Tidy the memory map
ú Show memory map (it will mess up your screen)
V Show info+version number
| Test new memory routine
\ Test compression routines (it will mess up your screen)
J,K Find out yourself
*********************************GENERAL***********************************
General (tips, etc.):
1) Because images will usually be displayed smaller than the original,
some pixels will not be visible. So even if the mask looks solid, there
may be some gaps in it. To fill up singular gaps in the mask you can
use 'dilation 8'. Excessive pixels can be removed by 'noise 1'.
2) If you want to select more than one group in the down-left window, you
can try the following:
Surround the groups by using the menu-button. (make sure they are fully
surrounded or they will disappear!). Shift-select in a masked-out
(black) part. Wait a second. Shift-select again at the same place, and
if you are lucky, your groups will be isolated. Using this method
multiple times can yield better results.
3) The screenmode is set in the file '!Mask.!Defaults'. Change this file
to your own preferences. The screenmode has to have 256 colors and a
size of at least 640 by 256 pixels.
4) The icon sprite was, ofcourse, made with this program.
5) Depending on the available memory, you can have up to 6 mask at a time.
You can select the mask by pressing the arrows (if they are there).
If there is just enough memory for only one mask, it will be very
difficult to produce good results, so save a part of the picture and
edit that, or give the program more memory.
6) If there is not enough memory for even one mask, the only thing you can
do is to view the picture. Making a mask will generate some fatal
error message or even kill your computer.
7) This program has been written on a 2Mb A3000 with arm3 and RO3.10 and
should work on all other arm based machines.
8) Some buttons have key-shortcuts:
L load A and = =
S save O or E eor
0 clear 1 set N not
Z zoom to mask X show full D zoom in
C zoom out M Morph
If anybody wants to write a (semi-) riscos version of this program, please
do so, but tell me first, so I can prevent multiple people doing the same
thing.
next versions:
This program is a collection of things that I liked to do and were quite
easy to do in the context of this program. This will not change in the
future.
Michel Grimminck 23 may 1993
Email:grimmink@phys.uva.nl
Smail:westerstraat 155▓
1015 MA Amsterdam
The Netherlands
------------------------------------------------------------------------
APPENDIX A |
¡¡¡¡¡¡¡¡¡-¡/
4-connectivity: the points marked by * are all 4-connected to P
8-connectivity: the points marked by + are all 8-connected to P
╖╖╖╖╖╖╖ ╖╖╖╖╖╖╖
╖╖╖*╖╖╖ ╖╖+++╖╖
╖╖*P*╖╖ ╖╖+P+╖╖
╖╖╖*╖╖╖ ╖╖+++╖╖
╖╖╖╖╖╖╖ ╖╖╖╖╖╖╖
-------------------------------------------------------------------------
APPENDIX B |
¡¡¡¡¡¡¡¡¡-¡/
Things that cannot be done with paletted files:
1)load:back Load file as background
2)Color operations, unless the palette allows it
3)Erase Erase if in mask
4)Set color of masked out part exactly good
5)Draw interpolated lines
6)blending (in photomorphing)
7)sharp Making pictures sharper
8)contrast
***************
Things that cannot be done with 24 bit files:
1)24bit Convert them to 24 bit
2)Hue Use 'HUE' for mask criteria
-------------------------------------------------------------------------
APPENDIX C |
¡¡¡¡¡¡¡¡¡-¡/
how to get !Translator:
!TRANSLATOR is a shareware program from:
John Kortink
Nutterbrink 31
7544 WJ Enschede
The Netherlands
or send email to john@dialis.hacktic.nl
Payment NOTE
------------
Payment in CASH ONLY PLEASE, in any currency, for the equivalent of 35 dutch
guilders (England ú10). The only exceptions may be (in order of preference) :
a) A Eurocheque, for 35 dutch guilders, *with* pass-number on the back
b) Postal exchange for 35 dutch guilders
c) Any other form of payment, which gets charged by the bank, but which I'm
happy to accept if I end up with 35 dutch guilders after bank charges.
Typical bank charges are ú8 on any non-a) payment.
(the above was written by John Kortink)